package edu.pku.sei.gefcommon.descriptor.descriptors;

import java.util.List;

import org.eclipse.gef.requests.CreationFactory;
import org.eclipse.jface.viewers.CellEditor;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.ui.views.properties.PropertyDescriptor;

import edu.pku.sei.gefcommon.descriptor.views.PopupPropertySheetDialog;


public class ListPropertyDescriptor extends PropertyDescriptor {
	public Class[] allow;//modified by fengchao  static public -> public
	public CreationFactory factory;//modified by fengchao  static public -> public
	//private MultipleType type;

	public ListPropertyDescriptor(Object id, String name,String catalog,Class[] allow) {
		super(id, name);
		this.setCategory(catalog);
		this.allow = allow;
		//this.type = type;
	}

	@Override
	public CellEditor createPropertyEditor(Composite parent) {

		PopupPropertySheetDialog dlg = new PopupPropertySheetDialog(parent
				.getShell());
		dlg.setListInputValue(values, allow);
		dlg.setCreationFactory(factory);
		dlg.open();
		return null;
	}
	
	public void setValues(List values) {
		this.values = values;
	}

	public void setCreationFactory(CreationFactory factory) {
		this.factory = factory;
	}
	
	public List values;//modified by fengchao  static public -> public
}
